#include "include/linkedstack.h"
#include "include/person.h"
#include "include/stackapplication.h"
#include <iostream>
using namespace std;


void testInt()
{
	LinkedStack<> s;
	s.push(32);
	s.push(11);
	cout << s.pop() << endl;
	cout << s.getTop()->getData() << endl;
}


void testPerson()
{
	LinkedStack<Person> s;

	Person p1("zhangsan", 23);
	auto* node1 = new Node<Person>();


	node1->setData(p1);

	s.push(node1);
	cout << s.getTop()->getData() << endl;
}


void reverseString(const char* src)
{
	assert(src != NULL);

	LinkedStack<char> s;
	while (*src != '\0')
		s.push(*src++);

	while (!s.isEmpty())
		cout << s.pop();

	cout << endl;
}


void match()
{
	Pair p1;
	match(p1, "23()3)32(");

	Pair p2('{', '}');
	match(p2, "while(){for{if(){}else}}}");
}

void testInfixToPostfix()
{
	string* postfix = infixToPostfix("32+4*(5-32)-3/1");

	cout<<countPostfix(postfix)<<endl;
	delete []postfix;

}
int main()
{
	//testInt();

	//testPerson();

	reverseString("++cevol");

	match();

	testInfixToPostfix();
	return 0;
}
